import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    loginusername: '',
    headerTitle: '',
    headerChildTitle:'',
    editGoodsID:''
  },
  mutations: {
    rememberLoginUser(state,value){
      state.loginusername = value;
    },
    keeppath(state,[value1,value2]){
      state.headerTitle = value1;
      state.headerChildTitle = value2;
    },
    giveHeaderTitle(state,value){
      if(value.authName!=state.headerTitle){
        state.headerChildTitle = '';
      };
      state.headerTitle = value.authName; 
    },
    giveHeaderChildTitle(state,value){
      state.headerChildTitle = value.authName;
    },
    resetInfo(state,flag){
      if(flag){
        state.loginusername = '';
        state.headerTitle = '';
        state.headerChildTitle = '';
      }else{
        state.headerTitle = '';
        state.headerChildTitle = '';
      }
    },
    giveEditGoodsID(state,value){
      state.editGoodsID = value;
    }
  },
  actions: {
  },
  modules: {
  }
})
